package com.bit.demo.springbookdemo.enums;

public enum BookStatusEnum {
    DELETED(0,"已删除"),
    NORMAL(1,"可借阅"),
    FORBIDDEN(2,"不可借阅");
    private Integer code;
    private String desc;

    BookStatusEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static BookStatusEnum getByCode(Integer code) {
        switch (code) {
            case 0:return DELETED;
            case 1:return NORMAL;
            case 2:return FORBIDDEN;
            default:return null;
        }
    }
    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }
}
